const express = require('express')
const router = express.Router()
const tools = require('../../model/tools')

router.get('/', (req, res) => {
  res.send("用户列表")
})

router.get('/add', (req, res) => {
  res.render('admin/user/add')
  // res.send("增加用户")
})

router.get('/edit', (req, res) => {
  res.send("修改列表")
})

var cpUpload = tools.multer().fields([{ name: 'avatar', maxCount: 1 }, { name: 'gallery', maxCount: 8 }]) 
router.post('/doAdd', cpUpload, (req, res) => {
  res.send({
    files: req.files,
    body: req.body
  })
  // res.send("执行增加")
})

router.get('/doEdit', (req, res) => {
  res.send("执行修改")
})

module.exports = router
